<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Staff extends CI_Controller
{
    public function __construct() {
        parent::__construct();
        $this->load->model('Staff_model');
        $this->load->model('Interviewer_model');
        $this->load->model('Search_model');
        $this->load->model('Cv_model');
        $this->load->model('Interviewer_model');
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->library('session');
        $this->load->library('pagination');
    }
    public function index()
    {
//         die(1);
        //var_dump($this->session->userdata('email'));
        $email=$this->session->userdata('email');
        $logined=$this->session->userdata('logined');
        if($logined=='true')
        {
            $roles = $this->session->userdata('roles');
            $data['email']=$email;
            $start_row = $this->uri->segment(3);
            $per_page = 10;
            $config['base_url'] =base_url().'staff/index';
            $query=$this->Staff_model->getStaff();
            $config['total_rows'] = $query->num_rows();
            $config['per_page'] = $per_page;
            $this->pagination->initialize($config);
            $data['pagination'] = $this->pagination->create_links();
            $data['title_content']="Manage Staff and Salary";
            $data['query'] = $this->Staff_model->getStaffLimited($per_page,$start_row);
            $this->load->view('_header',$data);
            $this->load->view('staff/getResultStaff'); 
            $this->load->view('_footer');
			        }
		else
			{
			$this->load->view('login');
			}
    }
    public function listStaffForeigners()
    {
       $email=$this->session->userdata('email');
       $data['email']=$email; 
       $start_row = $this->uri->segment(3);
            $per_page = 10;
            $config['base_url'] =base_url().'staff/index';
            $query=$this->Staff_model->getStaffForeigners();
            $config['total_rows'] = $query->num_rows();
            $config['per_page'] = $per_page;
            $this->pagination->initialize($config);
            $data['pagination'] = $this->pagination->create_links();
            $data['title_content']="Manage Staff and Salary";
            $data['query'] = $this->Staff_model->getStaffLimitedForeigners($per_page,$start_row);
            $this->load->view('_header',$data);
            $this->load->view('staff/getResultStaffForeigners'); 
            $this->load->view('_footer');
    }
    public function loadInterviewerPass()
    {
        $data['PositionInterview']=trim($this->security->sanitize_filename($this->input->post('txtPositionInterview')));
        $PositionInterview=trim($this->security->sanitize_filename($this->input->post('txtPositionInterview')));;
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['query']=$this->Interviewer_model->loadInterviewerPass($PositionInterview);
        $this->load->view('_header',$data);
        $this->load->view('interviewer/loadFormInterviewPass');
        $this->load->view('_footer');
        
    }
    public function loadFormInsertStaffBegin()
    {
        $data['email']=$this->session->userdata('email');
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormInsertStaffBegin');
        $this->load->view('_footer');
    }
    public function loadFormNextBegin()
    {
        $data['email']=$this->session->userdata('email');
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['Staff_ID']=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $FullName=trim($this->security->sanitize_filename($this->input->post('txtFullName')));
        $FirstName=trim($this->security->sanitize_filename($this->input->post('txtFirstName')));
        $LastName=trim($this->security->sanitize_filename($this->input->post('txtLastName')));
        $Day=trim($this->security->sanitize_filename($this->input->post('txtDay')));
        $Month=trim($this->security->sanitize_filename($this->input->post('txtMonth')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $DOB=$Day.'/'.$Month.'/'.$Year;
        $DayIssue=trim($this->security->sanitize_filename($this->input->post('txtDayIssue')));
        $MonthIssue=trim($this->security->sanitize_filename($this->input->post('txtMonthIssue')));
        $YearIssue=trim($this->security->sanitize_filename($this->input->post('txtYearIssue')));
        $POB=trim($this->security->sanitize_filename($this->input->post('txtPlaceBirthday')));
        $Marital=trim($this->security->sanitize_filename($this->input->post('txtMaritalStatus')));
        $Gender=trim($this->security->sanitize_filename($this->input->post('txtGender')));
        $PersonalTaxCode=trim($this->security->sanitize_filename($this->input->post('txtPersonalTaxCode')));
        $NumberOfDependent=trim($this->security->sanitize_filename($this->input->post('txtNumberOfDependent')));
        $ID_Number=trim($this->security->sanitize_filename($this->input->post('txtIDNumber')));
        $DOI=$DayIssue.'/'.$MonthIssue.'/'.$YearIssue;
        $POI=trim($this->security->sanitize_filename($this->input->post('txtPlaceOfIssue')));
        $HomePhone=trim($this->security->sanitize_filename($this->input->post('txtHomePhone')));
        $CellPhone=trim($this->security->sanitize_filename($this->input->post('txtCellPhone')));
        $PersonalEmail1=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail1')));
        $PersonalEmail2=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail2')));
        $CompanyEmail=trim($this->security->sanitize_filename($this->input->post('txtCompanyEmail')));
        $Foreigners=trim($this->security->sanitize_filename($this->input->post('txtForeigners')));
        $query=$this->Staff_model->checkStaffExist($Staff_ID);
        $query1=$this->Staff_model->checkIDNumberExist($ID_Number);
            $data['FullName']=$FullName;
            $data['FirstName']=$FirstName;
            $data['LastName']=$LastName;
            $data['Day']=$Day;
            $data['Month']=$Month;
            $data['Year']=$Year;
            $data['DayIssue']=$DayIssue;
            $data['MonthIssue']=$MonthIssue;
            $data['YearIssue']=$YearIssue;
            $data['Marital']=$Marital;
            $data['Gender']=$Gender;
            $data['PersonalTaxCode']=$PersonalTaxCode;
            $data['PersonalEmail1']=$PersonalEmail1;
            $data['PersonalEmail2']=$PersonalEmail2;
            $data['ID_Number']=$ID_Number;
            $data['NumberOfDependent']=$NumberOfDependent;
            $data['HomePhone']=$HomePhone;
            $data['CellPhone']=$CellPhone;
            $data['CompanyEmail']=$CompanyEmail;
            $data['Foreigners']=$Foreigners;
            $data['POB']=$POB;
            $data['POI']=$POI;
        if($query->num_rows()!=0)
        {
            $data['error_insertstaff']="Staff ID existed";
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertStaffBegin');
            $this->load->view('_footer');
        }
        else if($query1->num_rows()!=0)
        {
            $data['error_insertstaff1']="ID Number existed";
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertStaffBegin');
            $this->load->view('_footer');
        }
        else
        {
        $this->Staff_model->insertNext($Staff_ID,$FullName,$FirstName,$LastName,$DOB,$POB,
            $Marital,$Gender,$PersonalTaxCode,$NumberOfDependent,$ID_Number,$DOI,$POI,$HomePhone,$CellPhone,
            $PersonalEmail1,$PersonalEmail2,$CompanyEmail,$Foreigners);
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormNextBegin');
            $this->load->view('_footer');
        }
    }
    public function  loadFormInsertStaff($CV_ID)
    {
        $data['email']=$this->session->userdata('email');
        $data['CV_ID']=$CV_ID;
        $query=$this->Interviewer_model->loadInterviewerPassByCVID($CV_ID);
        foreach ($query->result() as $row)
        {
            $data['FullName']=$row->FullName;
            $data['FirstName']=$row->FirstName;
            $data['LastName']=$row->LastName;
            $data['POB']=$row->POB;
            $data['POI']=$row->POI;
            $data['ID_Number']=$row->ID_Number;
            $data['Gender']=$row->Gender;
            $data['HomPhone']=$row->HomePhone;
            $data['CellPhone']=$row->CellPhone;
            $data['CV_Sumup']=$row->CV_Sumup;
            $data['ID_Number']=$row->ID_Number;
            $data['PersonalEmail1']=$row->PersonalEmail1;
            $data['PersonalEmail2']=$row->PersonalEmail2;
            $data['MaristalStatus']=$row->MaristalStatus;
            $Birthday=$row->DOB;
            $DateIssue=$row->DOI;
            $data['Day']=substr($Birthday,0,2);
            $data['Month']=substr($Birthday,3,2);
            $data['Year']=substr($Birthday,6,4);
            $data['DayIssue']=substr($DateIssue,0,2);
            $data['MonthIssue']=substr($DateIssue,3,2);
            $data['YearIssue']=substr($DateIssue,6,4);
            $data['Foreigners']=$row->Foreigners;
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertStaff');
            $this->load->view('_footer');
        }
        
    }
    public function loadFormNext()
    {
        $data['email']=$this->session->userdata('email');
        $CV_ID=trim($this->security->sanitize_filename($this->input->post('txtCVID')));
        $query=$this->Interviewer_model->loadInterviewerPassByCVID($CV_ID);
        foreach ($query->result() as $row)
        {
        $data['CV_Sumup']=$row->CV_Sumup;
        }
        $data['Staff_ID1']=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['CV_ID1']=trim($this->security->sanitize_filename($this->input->post('txtCVID')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $FullName=trim($this->security->sanitize_filename($this->input->post('txtFullName')));
        $FirstName=trim($this->security->sanitize_filename($this->input->post('txtFirstName')));
        $LastName=trim($this->security->sanitize_filename($this->input->post('txtLastName')));
        $Day=trim($this->security->sanitize_filename($this->input->post('txtDay')));
        $Month=trim($this->security->sanitize_filename($this->input->post('txtMonth')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $DOB=$Day.'/'.$Month.'/'.$Year;
        $DayIssue=trim($this->security->sanitize_filename($this->input->post('txtDayIssue')));
        $MonthIssue=trim($this->security->sanitize_filename($this->input->post('txtMonthIssue')));
        $YearIssue=trim($this->security->sanitize_filename($this->input->post('txtYearIssue')));
        $POB=trim($this->security->sanitize_filename($this->input->post('txtPlaceBirthday')));
        $Marital=trim($this->security->sanitize_filename($this->input->post('txtMaritalStatus')));
        $Gender=trim($this->security->sanitize_filename($this->input->post('txtGender')));
        $PersonalTaxCode=trim($this->security->sanitize_filename($this->input->post('txtPersonalTaxCode')));
        $NumberOfDependent=trim($this->security->sanitize_filename($this->input->post('txtNumberOfDependent')));
        $ID_Number=trim($this->security->sanitize_filename($this->input->post('txtIDNumber')));
        $DOI=$DayIssue.'/'.$MonthIssue.'/'.$YearIssue;
        $POI=trim($this->security->sanitize_filename($this->input->post('txtPlaceOfIssue')));
        $HomePhone=trim($this->security->sanitize_filename($this->input->post('txtHomePhone')));
        $CellPhone=trim($this->security->sanitize_filename($this->input->post('txtCellPhone')));
        $PersonalEmail1=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail1')));
        $PersonalEmail2=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail2')));
        $CompanyEmail=trim($this->security->sanitize_filename($this->input->post('txtCompanyEmail')));
        $Foreigners=trim($this->security->sanitize_filename($this->input->post('txtForeigners')));
        $query2=$this->Interviewer_model->loadInterviewerPassByCVID($CV_ID);
        foreach ($query2->result() as $row2)
        {
            if($row2->FullName!="")
            $data['FullName']=$row2->FullName;
            else
                $data['FullName']=$FullName;
            if($row2->FirstName!="")
            $data['FirstName']=$row2->FirstName;
            else $data['FirstName']=$FirstName;
            if($row2->LastName!="")
            $data['LastName']=$row2->LastName;
            else $data['LastName']=$LastName;
            if($row2->POB=="")
            $data['POB']=$row2->POB;
            else $data['POB']=$POB;
            if($row2->POI!="")
            $data['POI']=$row2->POI;
            else $data['POI']=$POI;
            if($row2->ID_Number!="")
            $data['ID_Number']=$row2->ID_Number;
            else $data['ID_Number']=$ID_Number;
            if($row2->Gender!="")        
            $data['Gender']=$row2->Gender;
            else $data['Gender']=$Gender;
            if($row2->HomePhone!="")
            $data['HomPhone']=$row2->HomePhone;
            else $data['HomePhone']=$HomePhone;
            if($row2->CellPhone!="")
            $data['CellPhone']=$row2->CellPhone;
            else $data['CellPhone']=$CellPhone;
            $data['CV_Sumup']=$row2->CV_Sumup;
            $data['PersonalTaxCode']=$PersonalTaxCode;
            if($row2->PersonalEmail1!="")
            $data['PersonalEmail1']=$row2->PersonalEmail1;
            else $data['PersonalEmail1']=$PersonalEmail1;
            if($row2->PersonalEmail2!="")
            $data['PersonalEmail2']=$row2->PersonalEmail2;
            else $data['PersonalEmail2']=$PersonalEmail2;
            if($row2->MaristalStatus!="")
            $data['Marital']=$row2->MaristalStatus;
            else $data['Marital']=$Marital;
            if($row2->Foreigners!="")        
            $data['Foreigners']=$row2->Foreigners;
            else $data['Foreigners']=$Foreigners;
            $Birthday=$row2->DOB;
            $DateIssue=$row2->DOI;
            if($Birthday!="")
            {
            $data['Day']=substr($Birthday,0,2);
            $data['Month']=substr($Birthday,3,2);
            $data['Year']=substr($Birthday,6,4);
            }
        else {
            $data['Day']=$Day;
            $data['Month']=$Month;
            $data['Year']=$Year;
        }
        if($DateIssue!="")
        {
            $data['DayIssue']=substr($DateIssue,0,2);
            $data['MonthIssue']=substr($DateIssue,3,2);
            $data['YearIssue']=substr($DateIssue,6,4);
        }
        else
        {
            $data['DayIssue']=$DayIssue;
            $data['MonthIssue']=$MonthIssue;
            $data['YearIssue']=$YearIssue;
        }
            $data['NumberOfDependent']=$NumberOfDependent;
            $data['CompanyEmail']=$CompanyEmail;
            //$data['Foreigners']=$Foreigners;
            
        }
        $query1=$this->Staff_model->checkStaffExist($Staff_ID);
        $query3=$this->Staff_model->checkIDNumberExist($ID_Number);
        if($query1->num_rows()!=0)
        {
            $data['error_insertstaff']="Staff ID  existed";
            $data['CV_ID']=$CV_ID;
            $data['Staff_ID']=$Staff_ID;
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertStaff');
            $this->load->view('_footer');
            
        
        }
        else if($query3->num_rows()!=0)
        {
            $data['error_insertstaff1']="ID Number existed";
            $data['CV_ID']=$CV_ID;
            $data['Staff_ID']=$Staff_ID;
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertStaff');
            $this->load->view('_footer');
        }
        else
        {
            $this->Staff_model->insertNext($Staff_ID,$FullName,$FirstName,$LastName,$DOB,$POB,
            $Marital,$Gender,$PersonalTaxCode,$NumberOfDependent,$ID_Number,$DOI,$POI,$HomePhone,$CellPhone,
            $PersonalEmail1,$PersonalEmail2,$CompanyEmail,$Foreigners);
            $this->Staff_model->deleteInterviewByCVID($CV_ID);
            $this->Staff_model->deleteCVByCVID($CV_ID);
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormNext');
            $this->load->view('_footer');
        }
    }
    public function loadFormInsertFamily($Staff_ID)
    {
        $data['email']=$this->session->userdata('email');
        $data['Staff_ID']=$Staff_ID;
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['Name']=$row1->FullName;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormInsertFamily');
        $this->load->view('_footer');
    }
    public function viewInformationStaff($Staff_ID)
    {
        $query=$this->Staff_model->getStaffByID($Staff_ID);
        foreach ($query->result() as $row)
        {
            $data['Staff_ID']=$row->Staff_ID;
            $data['FullName']=$row->FullName;
            $data['FirstName']=$row->FirstName;
            $data['LastName']=$row->LastName;
            $data['DOB']=$row->DOB;
            $data['POB']=$row->POB;
            $data['MaristalStatus']=$row->MaristalStatus;
            $data['Gender']=$row->Gender;
            $data['PersonalTaxCode']=$row->PersonalTaxCode;
            $data['NumberOfDependent']=$row->NumberOfDependent;
            $data['ID_Number']=$row->ID_Number;
            $data['DOI']=$row->DOI;
            $data['POI']=$row->POI;
            $data['HomePhone']=$row->HomePhone;
            $data['CellPhone']=$row->CellPhone;
            $data['PersonalEmail1']=$row->PersonalEmail1;
            $data['PersonalEmail2']=$row->PersonalEmail2;
            $data['CompanyEmail']=$row->CompanyEmail;
            $data['PA_NSWD']=$row->PA_NSWD;
            $data['PA_City']=$row->PA_City;
            $data['PA_Country']=$row->PA_Country;
            $data['CV_Sumup']=$row->CV_Sumup;
            $data['CA_NSWD']=$row->CA_NSWD;
            $data['CA_City']=$row->CA_City;
            $data['CA_Country']=$row->CA_Country;
            $data['VehicleNo']=$row->VehicleNo;
            $data['VehicleType']=$row->VehicleType;
            $data['VehicleColour']=$row->VehicleColour;

        }
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['Name']=$row1->FullName;
        }

            $this->load->view('_header',$data);
            $this->load->view('staff/viewInformationStaff');
            $this->load->view('_footer');
    }
    public function loadStaffUpdateForm($Staff_ID)
    {
        $query=$this->Staff_model->getStaffByID($Staff_ID);
        foreach ($query->result() as $row)
        {
            $data['Staff_ID']=$row->Staff_ID;
            $data['FullName']=$row->FullName;
            $data['FirstName']=$row->FirstName;
            $data['LastName']=$row->LastName;
            $Date=$row->DOB;
            $data['Day']=  substr($Date, 0, 2);
            $data['Month']=  substr($Date, 3, 2);
            $data['Year']=  substr($Date, 6, 4);
            $data['POB']=$row->POB;
            $data['MaristalStatus']=$row->MaristalStatus;
            $data['Gender']=$row->Gender;
            $data['PersonalTaxCode']=$row->PersonalTaxCode;
            $data['NumberOfDependent']=$row->NumberOfDependent;
            $data['ID_Number']=$row->ID_Number;
            $DateIssue=$row->DOI;
            $data['DayIssue']=  substr($DateIssue, 0, 2);
            $data['MonthIssue']=  substr($DateIssue, 3, 2);
            $data['YearIssue']=  substr($DateIssue, 6, 4);
            $data['POI']=$row->POI;
            $data['HomePhone']=$row->HomePhone;
            $data['CellPhone']=$row->CellPhone;
            $data['PersonalEmail1']=$row->PersonalEmail1;
            $data['PersonalEmail2']=$row->PersonalEmail2;
            $data['CompanyEmail']=$row->CompanyEmail;
            $data['PA_NSWD']=$row->PA_NSWD;
            $data['PA_City']=$row->PA_City;
            $data['PA_Country']=$row->PA_Country;
            $data['CV_Sumup']=$row->CV_Sumup;
            $data['CA_NSWD']=$row->CA_NSWD;
            $data['CA_City']=$row->CA_City;
            $data['CA_Country']=$row->CA_Country;
            $data['VehicleNo']=$row->VehicleNo;
            $data['VehicleType']=$row->VehicleType;
            $data['VehicleColour']=$row->VehicleColour;

            
        }
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['Name']=$row1->FullName;
        }

            $this->load->view('_header',$data);
            $this->load->view('staff/loadStaffUpdateForm');
            $this->load->view('_footer');
    }
    public function insertStaff()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $CV_ID=trim($this->security->sanitize_filename($this->input->post('txtCVID')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $PANSWD=trim($this->security->sanitize_filename($this->input->post('txtPANSWD')));
        $PACity=trim($this->security->sanitize_filename($this->input->post('txtPACity')));
        $PACountry=trim($this->security->sanitize_filename($this->input->post('txtPACountry')));
        $CVSumup=trim($this->security->sanitize_filename($this->input->post('txtCVSUmup')));
        $CANSWD=trim($this->security->sanitize_filename($this->input->post('txtCANSWD')));
        $CACity=trim($this->security->sanitize_filename($this->input->post('txtCACity')));
        $CACountry=trim($this->security->sanitize_filename($this->input->post('txtCACountry')));
        $VehicleNo=trim($this->security->sanitize_filename($this->input->post('txtVehicleNo')));
        $VehicleType=trim($this->security->sanitize_filename($this->input->post('txtVehicleType')));
        $VehicleColor=trim($this->security->sanitize_filename($this->input->post('txtVehicleColor')));
    if($this->Staff_model->insertStaff($Staff_ID,$PANSWD,$PACity,
            $PACountry,$CVSumup,$CANSWD,$CACity,
            $CACountry,$VehicleNo,$VehicleType,$VehicleColor))
        {
        redirect('staff/loadFormInsertExperience/'.$Staff_ID);
        } 
    }
    public function insertStaffBegin()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        //$CV_ID=trim($this->security->sanitize_filename($this->input->post('txtCVID')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['Staff_ID']=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $PANSWD=trim($this->security->sanitize_filename($this->input->post('txtPANSWD')));
        $PACity=trim($this->security->sanitize_filename($this->input->post('txtPACity')));
        $PACountry=trim($this->security->sanitize_filename($this->input->post('txtPACountry')));
        $CVSumup=trim($this->security->sanitize_filename($this->input->post('txtCVSUmup')));
        $CANSWD=trim($this->security->sanitize_filename($this->input->post('txtCANSWD')));
        $CACity=trim($this->security->sanitize_filename($this->input->post('txtCACity')));
        $CACountry=trim($this->security->sanitize_filename($this->input->post('txtCACountry')));
        $VehicleNo=trim($this->security->sanitize_filename($this->input->post('txtVehicleNo')));
        $VehicleType=trim($this->security->sanitize_filename($this->input->post('txtVehicleType')));
        $VehicleColor=trim($this->security->sanitize_filename($this->input->post('txtVehicleColor')));
        if($this->Staff_model->insertStaff($Staff_ID,$PANSWD,$PACity,
            $PACountry,$CVSumup,$CANSWD,$CACity,
            $CACountry,$VehicleNo,$VehicleType,$VehicleColor))
        {
            redirect('staff/loadFormInsertExperience/'.$Staff_ID);
        }
    }
    public function editStaff()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        //$CV_ID=trim($this->security->sanitize_filename($this->input->post('txtCVID')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $FullName=trim($this->security->sanitize_filename($this->input->post('txtFullName')));
        $FirstName=trim($this->security->sanitize_filename($this->input->post('txtFirstName')));
        $LastName=trim($this->security->sanitize_filename($this->input->post('txtLastName')));
        $Day=trim($this->security->sanitize_filename($this->input->post('txtDay')));
        $Month=trim($this->security->sanitize_filename($this->input->post('txtMonth')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $DOB=$Day.'/'.$Month.'/'.$Year;
        $DayIssue=trim($this->security->sanitize_filename($this->input->post('txtDayIssue')));
        $MonthIssue=trim($this->security->sanitize_filename($this->input->post('txtMonthIssue')));
        $YearIssue=trim($this->security->sanitize_filename($this->input->post('txtYearIssue')));
        $POB=trim($this->security->sanitize_filename($this->input->post('txtPOB')));
        $Marital=trim($this->security->sanitize_filename($this->input->post('txtMaristalStatus')));
        $Gender=trim($this->security->sanitize_filename($this->input->post('txtGender')));
        $PersonalTaxCode=trim($this->security->sanitize_filename($this->input->post('txtPersonalTaxCode')));
        $NumberOfDependent=trim($this->security->sanitize_filename($this->input->post('txtNumberOfDependent')));
        $ID_Number=trim($this->security->sanitize_filename($this->input->post('txtID_Number')));
        $DOI=$DayIssue.'/'.$MonthIssue.'/'.$YearIssue;
        $POI=trim($this->security->sanitize_filename($this->input->post('txtPOI')));
        $HomePhone=trim($this->security->sanitize_filename($this->input->post('txtHomePhone')));
        $CellPhone=trim($this->security->sanitize_filename($this->input->post('txtCellPhone')));
        $PersonalEmail1=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail1')));
        $PersonalEmail2=trim($this->security->sanitize_filename($this->input->post('txtPersonalEmail2')));
        $CompanyEmail=trim($this->security->sanitize_filename($this->input->post('txtCompanyEmail')));
        $PANSWD=trim($this->security->sanitize_filename($this->input->post('txtPA_NSWD')));
        $PACity=trim($this->security->sanitize_filename($this->input->post('txtPA_City')));
        $PACountry=trim($this->security->sanitize_filename($this->input->post('txtPA_Country')));
        $CVSumup=trim($this->security->sanitize_filename($this->input->post('txtCVSumup')));
        $CANSWD=trim($this->security->sanitize_filename($this->input->post('txtCA_NSWD')));
        $CACity=trim($this->security->sanitize_filename($this->input->post('txtCA_City')));
        $CACountry=trim($this->security->sanitize_filename($this->input->post('txtCA_Country')));
        $VehicleNo=trim($this->security->sanitize_filename($this->input->post('txtVehicleNo')));
        $VehicleType=trim($this->security->sanitize_filename($this->input->post('txtVehicleType')));
        $VehicleColor=trim($this->security->sanitize_filename($this->input->post('txtVehicleColour')));

        /*$query=$this->Staff_model->checkStaffExist($Staff_ID);
        if($query->num_rows()!=0)
        {
            $data['error_insertstaff']="Staff ID existed";
            $this->loadStaffUpdateForm($Staff_ID);
        }
        else
        {*/
        if($this->Staff_model->editStaff($Staff_ID,$FullName,$FirstName,$LastName,$DOB,$POB,
            $Marital,$Gender,$PersonalTaxCode,$NumberOfDependent,$ID_Number,$DOI,$POI,$HomePhone,$CellPhone,
            $PersonalEmail1,$PersonalEmail2,$CompanyEmail,$PANSWD,$PACity,
            $PACountry,$CVSumup,$CANSWD,$CACity,
            $CACountry,$VehicleNo,$VehicleType,$VehicleColor))
        $this->index();
        }
    public function loadListFamily($Staff_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['Staff_ID']=$Staff_ID;
        $data['query']=$this->Staff_model->getFamilyByStaffID($Staff_ID);
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['Name']=$row1->FullName;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadListFamily');
        $this->load->view('_footer');
    }
    public function insertFamily()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $insertfamily=trim($this->security->sanitize_filename($this->input->post('insertfamily')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $Relative=trim($this->security->sanitize_filename($this->input->post('txtRelative')));
        $FullName=trim($this->security->sanitize_filename($this->input->post('txtFullName')));
        $Gender=trim($this->security->sanitize_filename($this->input->post('txtGender')));
        $Day=trim($this->security->sanitize_filename($this->input->post('txtDay')));
        $Month=trim($this->security->sanitize_filename($this->input->post('txtMonth')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $data['Day']=$Day;
        $data['Month']=$Month;
        $data['Year']=$Year;
        $data['Gender']=$Gender;
        $data['FullName']=$FullName;
        $data['Relative']=$Relative;
        $DOB=$Day."/".$Month."/".$Year;
        $sql="select * from Family where Staff_ID='$Staff_ID' and Relative='$Relative'";
        $query=$this->db->query($sql);
        if($query->num_rows()>0)
        {
            $data['relative_exist']=$Relative." existed";
            $data['Staff_ID']=$Staff_ID;
            $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
            foreach ($query1->result() as $row1)
            {
            $data['Name']=$row1->FullName;
            }
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertFamily');
            $this->load->view('_footer');
        }
        else
        {
        $this->Staff_model->insertFamily($Staff_ID,$Relative,$FullName,$Gender,$DOB);

            //$query=$this->Staff_model->getFullNameByStaffID($Staff_ID);
            //foreach ($query->result() as $row)
            //{
            //$data['FullName']=$row->FullName;
            //$data['query']=$this->Staff_model->getFamilyByStaffID($Staff_ID);
            redirect('staff/loadListFamily/'.$Staff_ID);
            //}
        }
        
    }
    public function deleteStaff($Staff_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $roles=$this->session->userdata('roles');
        $this->db->where('Staff_ID',$Staff_ID);
        $query=$this->db->get('Contract');
        if($query->num_rows()>0||$roles!=0)
        {
            $data['notallowdel']="You can't delete this user";
            $this->load->view('_header',$data);
            $this->load->view('notAllowDel');
            $this->load->view('_footer');
        }
        else
        {
        $this->Staff_model->deleteStaff($Staff_ID);
        redirect('staff/index');
        }
    }
    public function viewExperienceStaff($Staff_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['Staff_ID']=$Staff_ID;
        $query=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query->result() as $row)
        {
            $data['FullName']=$row->FullName;
        }
        $start_row = $this->uri->segment(3);
        $per_page = 10;
        $config['base_url'] =base_url().'staff/viewExperienceStaff/'.$Staff_ID;
        $query1=$this->Staff_model->getListExperienceStaff($Staff_ID);
        //$data['query']=$this->Staff_model->getListExperienceStaff($Staff_ID);
        $config['total_rows'] = $query1->num_rows();
        $data['total_rows']=$query1->num_rows();
        $config['per_page'] = $per_page;
        $this->pagination->initialize($config);
        $data['pagination'] = $this->pagination->create_links();
        $data['title_content']="Manage Staff and Salary";
        $data['query']=$this->Staff_model->getListExperienceStaff($Staff_ID);
        $this->load->view('_header',$data);
        $this->load->view('staff/listExperienceStaff');
        $this->load->view('_footer');
    }
    public function loadFormInsertExperience($Staff_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['Staff_ID']=$Staff_ID;
        $query=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query->result() as $row)
        {
            $data['FullName']=$row->FullName;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormInsertExperienceStaff');
        $this->load->view('_footer');
    }
    public function insertExperienceStaff()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['Staff_ID']=$Staff_ID;
        $Education=trim($this->security->sanitize_filename($this->input->post('txtEducation')));
        $PreviousPosition=trim($this->security->sanitize_filename($this->input->post('txtPreviousPosition')));
        $Company=trim($this->security->sanitize_filename($this->input->post('txtCompany')));
        $Industry=trim($this->security->sanitize_filename($this->input->post('txtIndustry')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $query=$this->Staff_model->checkExperienceStaff($Staff_ID,$Education,$PreviousPosition,$Company,$Industry,$Year);
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['FullName']=$row1->FullName;
        }
        if($query->num_rows()!=0)
        {
            $data['Education']=$Education;
            $data['PreviousPosition']=$PreviousPosition;
            $data['Company']=$Company;
            $data['Industry']=$Industry;
            $data['Year']=$Year;
            $data['experience_exist']="Experience was added";
            $this->load->view('_header',$data);
            $this->load->view('staff/loadFormInsertExperienceStaff');
            $this->load->view('_footer');
        }
        else
        {
            $this->Staff_model->insertExperienceStaff($Staff_ID,$Education,$PreviousPosition,$Company,$Industry,$Year);
            $this->index();
        }
    }
    public function loadExperienceUpdateForm($ES_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $ES=  explode("-", $ES_ID);
        $Experience_ID=$ES[0];
        $Staff_ID=$ES[1];
        $data['Experience_ID']=$Experience_ID;
        $data['Staff_ID']=$Staff_ID;
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['FullName']=$row1->FullName;
        }
        $query=$this->Staff_model->getExperienceByExperienceID($Experience_ID);
        foreach ($query->result() as $row)
        {
            $data['Education']=$row->Education;
            $data['PreviousPosition']=$row->PreviousPosition;
            $data['Company']=$row->Company;
            $data['Industry']=$row->Industry;
            $data['Year']=$row->Year;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadExperienceUpdateForm');
        $this->load->view('_footer');
    }
    public function updateExperienceStaff()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['Staff_ID']=$Staff_ID;
        $Experience_ID=trim($this->security->sanitize_filename($this->input->post('txtExperienceID')));
        $data['Experience_ID']=$Experience_ID;
        $Education=trim($this->security->sanitize_filename($this->input->post('txtEducation')));
        $PreviousPosition=trim($this->security->sanitize_filename($this->input->post('txtPreviousPosition')));
        $Company=trim($this->security->sanitize_filename($this->input->post('txtCompany')));
        $Industry=trim($this->security->sanitize_filename($this->input->post('txtIndustry')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $query=$this->Staff_model->checkExperienceStaff($Staff_ID,$Education,$PreviousPosition,$Company,$Industry,$Year);
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach ($query1->result() as $row1)
        {
            $data['FullName']=$row1->FullName;
        }
        
            $this->Staff_model->updateExperienceStaff($Experience_ID,$Education,$PreviousPosition,$Company,$Industry,$Year);
            redirect('staff/viewExperienceStaff/'.$Staff_ID);
    }
    public function deleteExperienceStaff($ES_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $ES=  explode("-", $ES_ID);
        $Experience_ID=$ES[0];
        $Staff_ID=$ES[1];
        $data['Experience_ID']=$Experience_ID;
        $data['Staff_ID']=$Staff_ID;
        $this->Staff_model->deleteExperienceStaff($Experience_ID);
        redirect('staff/viewExperienceStaff/'.$Staff_ID);
        
    }
    public function loadFormAddPassVi($ID_Number)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['ID_Number']=$ID_Number;
        $query=$this->Staff_model->getFullNameByIDNumber($ID_Number);
        foreach($query->result() as $row)
        {
            $data['FullName']=$row->FullName;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormAddPassVi');
        $this->load->view('_footer');
    }
    public function addPassVi()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $ID_Number=trim($this->security->sanitize_filename($this->input->post('txtIDNumber')));
        $data['ID_Number']=$ID_Number;
        $Type=trim($this->security->sanitize_filename($this->input->post('txtType')));
        $Nationality=trim($this->security->sanitize_filename($this->input->post('txtNationality')));
        $NumberVisa=trim($this->security->sanitize_filename($this->input->post('txtNumberVisa')));
        $VisaDayStart=trim($this->security->sanitize_filename($this->input->post('txtVisaDayStart')));
        $VisaMonthStart=trim($this->security->sanitize_filename($this->input->post('txtVisaMonthStart')));
        $VisaYearStart=trim($this->security->sanitize_filename($this->input->post('txtVisaYearStart')));
        $VisaDayEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaDayEnd')));
        $VisaMonthEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaMonthEnd')));
        $VisaYearEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaYearEnd')));
        /*$VisaDayUpdate=trim($this->security->sanitize_filename($this->input->post('txtDayUpdate')));
        $VisaMonthUpdate=trim($this->security->sanitize_filename($this->input->post('txtMonthUpdate')));
        $VisaYearUpdate=trim($this->security->sanitize_filename($this->input->post('txtYearUpdate')));*/
        $VisaDateStart=$VisaDayStart.'/'.$VisaMonthStart.'/'.$VisaYearStart;
        $VisaDateEnd=$VisaDayEnd.'/'.$VisaMonthEnd.'/'.$VisaYearEnd;
        //$VisaDateUpdate=$VisaDayUpdate.'/'.$VisaMonthUpdate.'/'.$VisaYearUpdate;
        if($this->Staff_model->addViPass($ID_Number,$Type,$Nationality,$NumberVisa,$VisaDateStart,$VisaDateEnd))
        {
            redirect('staff/listStaffForeigners');
        }
    }
    public function loadFormUpdatePassVi($ID_Number)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $data['ID_Number']=$ID_Number;
        $query=$this->Staff_model->getFullNameByIDNumber($ID_Number);
        foreach($query->result() as $row)
        {
            $data['FullName']=$row->FullName;
        }
        $query1=$this->Staff_model->getPassViByIDNumber($ID_Number);
        foreach ($query1->result() as $row1)
        {
            $data['Type']=$row1->Type;
            $data['Nationality']=$row1->Nationality;
            $data['NumberVisa']=$row1->NumberVisa;
            $VisaDateStart=$row1->VisaDateStart;
            $VisaDateEnd=$row1->VisaDateEnd;
            $VisaDateUpdate=$row1->VisaDateUpdate;
            $data['VisaDayStart']=  substr($VisaDateStart, 0, 2);
            $data['VisaMonthStart']=  substr($VisaDateStart, 3, 2);
            $data['VisaYearStart']=  substr($VisaDateStart, 6, 4);
            $data['VisaDayEnd']=  substr($VisaDateEnd, 0, 2);
            $data['VisaMonthEnd']=  substr($VisaDateEnd, 3, 2);
            $data['VisaYearEnd']=  substr($VisaDateEnd, 6, 4);
            $data['VisaDayUpdate']=  substr($VisaDateUpdate, 0, 2);
            $data['VisaMonthUpdate']=  substr($VisaDateUpdate, 3, 2);
            $data['VisaYearUpdate']=  substr($VisaDateUpdate, 6, 4);
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormUpdatePassVi');
        $this->load->view('_footer');
    }
    public function updatePassVi()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $ID_Number=trim($this->security->sanitize_filename($this->input->post('txtIDNumber')));
        $data['ID_Number']=$ID_Number;
        $Type=trim($this->security->sanitize_filename($this->input->post('txtType')));
        $Nationality=trim($this->security->sanitize_filename($this->input->post('txtNationality')));
        $NumberVisa=trim($this->security->sanitize_filename($this->input->post('txtNumberVisa')));
        $VisaDayStart=trim($this->security->sanitize_filename($this->input->post('txtVisaDayStart')));
        $VisaMonthStart=trim($this->security->sanitize_filename($this->input->post('txtVisaMonthStart')));
        $VisaYearStart=trim($this->security->sanitize_filename($this->input->post('txtVisaYearStart')));
        $VisaDayEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaDayEnd')));
        $VisaMonthEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaMonthEnd')));
        $VisaYearEnd=trim($this->security->sanitize_filename($this->input->post('txtVisaYearEnd')));
        $VisaDayUpdate=trim($this->security->sanitize_filename($this->input->post('txtVisaDayUpdate')));
        $VisaMonthUpdate=trim($this->security->sanitize_filename($this->input->post('txtVisaMonthUpdate')));
        $VisaYearUpdate=trim($this->security->sanitize_filename($this->input->post('txtVisaYearUpdate')));
        $VisaDateStart=$VisaDayStart.'/'.$VisaMonthStart.'/'.$VisaYearStart;
        $VisaDateEnd=$VisaDayEnd.'/'.$VisaMonthEnd.'/'.$VisaYearEnd;
        $VisaDateUpdate=$VisaDayUpdate.'/'.$VisaMonthUpdate.'/'.$VisaYearUpdate;
        if($this->Staff_model->updatePassVi($ID_Number,$Type,$Nationality,$NumberVisa,$VisaDateStart,$VisaDateEnd,$VisaDateUpdate))
        {
            redirect('staff/listStaffForeigners');
        }
    }
    public function loadFamilyUpdateForm($FS_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $FS=  explode("-", $FS_ID);
        $Family_ID=$FS[0];
        $Staff_ID=$FS[1];
        $data['Family_ID']=$Family_ID;
        $data['Staff_ID']=$Staff_ID;
        $query=$this->Staff_model->getFamilyByFamilyID($Family_ID);
        foreach ($query->result() as $row)
        {
            $data['Relative']=$row->Relative;
            $data['FullName']=$row->FullName;
            $data['Gender']=$row->Gender;
            $Birthday=$row->DOB;
            $data['Day']=  substr($Birthday, 0, 2);
            $data['Month']=  substr($Birthday, 3, 2);
            $data['Year']=substr($Birthday,6,4);
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/loadFormUpdateFamily');
        $this->load->view('_footer');
    }
    public function deleteFamily($FS_ID)
    {
        $FS=  explode("-", $FS_ID);
        $Family_ID=$FS[0];
        $Staff_ID=$FS[1];
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $this->Staff_model->deleteFamily($Family_ID);
        redirect('staff/loadListFamily/'.$Staff_ID);
    }
    public function updateFamily()
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $Family_ID=trim($this->security->sanitize_filename($this->input->post('txtFamilyID')));
        $Staff_ID=trim($this->security->sanitize_filename($this->input->post('txtStaffID')));
        $data['Family_ID']=$Family_ID;
        $data['Staff_ID']=$Staff_ID;
        $FullName=trim($this->security->sanitize_filename($this->input->post('txtFullName')));
        $Day=trim($this->security->sanitize_filename($this->input->post('txtDay')));
        $Month=trim($this->security->sanitize_filename($this->input->post('txtMonth')));
        $Year=trim($this->security->sanitize_filename($this->input->post('txtYear')));
        $DOB=$Day.'/'.$Month.'/'.$Year;
        $Relative=trim($this->security->sanitize_filename($this->input->post('txtRelative')));
        $Gender=trim($this->security->sanitize_filename($this->input->post('txtGender')));
        $this->Staff_model->updateFamily($Family_ID,$Relative,$FullName,$Gender,$DOB);
        redirect('staff/loadListFamily/'.$Staff_ID);
    }
    public function viewListSalaryOneStaff($Staff_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $query=$this->Staff_model->getSalaryByStaffID($Staff_ID);
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach($query1->result() as $row1)
        {
            $data['FullName']=$row1->FullName;
        }
        if($query->num_rows()==0)
        {
            $data['error_salary']=$row1->FullName."  was not calculated salary";
            $this->load->view('_header',$data);
            $this->load->view('notCalculateSalary');
            $this->load->view('_footer');
        }
        else
        {
            $start_row = $this->uri->segment(4);
            $per_page = 10;
            $config['base_url'] =base_url().'staff/viewListSalaryOneStaff/'.$Staff_ID;
            //$query1=$this->Staff_model->getSalaryByStaffID($Staff_ID);
            //$data['query']=$this->Staff_model->getListExperienceStaff($Staff_ID);
            $config['total_rows'] = $query->num_rows();
            $data['total_rows']=$query->num_rows();
            $config['per_page'] = $per_page;
            $this->pagination->initialize($config);
            $data['pagination'] = $this->pagination->create_links();
            $data['title_content']="Manage Staff and Salary";
            $data['query']=$this->Staff_model->getSalaryByStaffIDLimited($Staff_ID,$per_page,$start_row);
            $this->load->view('_header',$data);
            $this->load->view('staff/viewListSalaryOneStaff');
            $this->load->view('_footer');
        }
        
    }
    public function viewSalaryOneStaff($SFT_ID)
    {
        $email=$this->session->userdata('email');
        $data['email']=$email;
        $SFT=  explode(".", $SFT_ID);
        $Staff_ID=$SFT[0];
        $FromDate=$SFT[1];
        $ToDate=$SFT[2];
        $data['Staff_ID']=$Staff_ID;
        $query=$this->Staff_model->getListSalaryByStaffID($Staff_ID,$FromDate,$ToDate);
        $query1=$this->Staff_model->getFullNameByStaffID($Staff_ID);
        foreach($query1->result() as $row1)
        {
            $data['FullName']=$row1->FullName;
        }
        if($query->num_rows()==0)
        {
            $data['error_salary']=$row1->FullName."  was calculated salary";
            $this->load->view('_header',$data);
            $this->load->view('notCalculateSalary');
            $this->load->view('_footer');
        }
        else
        {
        foreach($query->result() as $row)
        {
            $data['FromDate']=$row->FromDate;
            $data['ToDate']=$row->ToDate;
            $data['BasicSalary']=$row->BasicSalary;
            $data['ActSalary']=$row->ActSalary;
            $data['WorkingDay']=$row->WorkingDay;
            $data['WorkedDay']=$row->WorkedDay;
            $data['TotalAllowance']=$row->TotalAllowance;
            $data['E_SI']=$row->E_SI;
            $data['E_HI']=$row->E_HI;
            $data['E_UI']=$row->E_UI;
            $data['E_SHU']=$row->E_SHU;
            $data['C_SI']=$row->C_SI;
            $data['C_UI']=$row->C_UI;
            $data['C_HI']=$row->C_HI;
            $data['C_SHU']=$row->C_SHU;
            $data['PerformanceBonus']=$row->PerformanceBonus;
            $data['PIT']=$row->PIT;
            $data['NoneTax']=$row->NoneTax;
            $data['PreTax']=$row->PreTax;
            $data['Tax']=$row->Tax;
            $data['ComDeduction']=$row->ComDeduction;
            $data['PaySalary']=$row->PaySalary;
            $data['Total']=$row->Total;
        }
        $this->load->view('_header',$data);
        $this->load->view('staff/viewSalaryOneStaff');
        $this->load->view('_footer');
        }
    }
}
?>
